#pragma once
#include "TypeDefs.h"
class color
{
public:
	color(void);
	color(const color &a);
	color(const vector4 &vecA);
	//color(int r, int g, int b, int a = 255);
	//color(uint r, uint g, uint b, uint a = 255);
	explicit color(int r, int g, int b, int a = 255);
	color(float r, float g, float b, float a = 1.0f);
	~color(void);
	float fR() const { return r/255.0f; };
	float fG() const { return g/255.0f; };
	float fB() const { return b/255.0f; };
	float fA() const { return a/255.0f; };

	static color Lerp(const color &a, const color &b, float step)
	{
		byte sR = a.r + (byte)((b.r - a.r) * step);
		byte sG = a.g + (byte)((b.g - a.g) * step);
		byte sB = a.b + (byte)((b.b - a.b) * step);
		byte sA = a.a + (byte)((b.a - a.a) * step);
		return color(sR, sG, sB, sA);
	};
	static color FromHLS(int hue, float saturation, float lightness);

	byte r;
	byte g;
	byte b;
	byte a;

public:
	//Additives
	static const color White;
	static const color Black;
	//Primary
	static const color Red;
	static const color Green;
	static const color Blue;	
	//Secondary
	static const color Teal;
	static const color Purple;
	static const color Yellow;
};

inline color operator+(const color a, const color &b) 
{ return color(a.r + b.r, a.g + b.g, a.b + b.b, a.a); };
inline color operator-(const color &a, const color &b)
{return color(a.r - b.r, a.g - b.g, a.b - b.b, a.a);};
inline color operator*(const color &c, const float &a)
{return color((byte)(c.r * a), (byte)(c.g * a), (byte)(c.b * a), (byte)(c.a));};
inline color operator/(const color &c, const float &a)
{return color((byte)(c.r / a), (byte)(c.g / a), (byte)(c.b / a), (byte)(c.a));};